<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 数字类型：数值和非数值 -->
</body>
<script>
    console.log(window.isNaN(NaN));  // t 
    console.log(isNaN(true)); // f
    console.log(isNaN(null)); // f
    console.log(isNaN(undefined)); // t
    console.log(isNaN(1)); // f
</script>
<script>
    console.log(Number.parseInt == parseInt);
    console.log(Number.isNaN == isNaN);
    // 1、Number.isNaN函数：用于判断传入的是否是非数值 先判断是不是数字类型 
    console.log(Number.isNaN(NaN)); // t 
    console.log(Number.isNaN(false)); // f
    console.log(Number.isNaN(null)); // f
    console.log(Number.isNaN(undefined)); // f
    console.log(Number.isNaN(2)); // f
    // 2、Number.isFinite函数：用来检查一个数值是否非无穷。（有限的）
    console.log(Number.isFinite(2.1231)); // t
    console.log(Number.isFinite('2.1231')); //  f
    console.log(Number.isFinite(Math.PI)); // t
    console.log(Number.isFinite(Infinity)); // f
    console.log(Number.isFinite(-Infinity)); // f
    console.log(Number.isFinite(3.000000000)); // t
    console.log(Number.isFinite(null)); // f
    console.log(Number.isFinite(true)); // f
    // 3、Number.parseInt函数：返回一个整数。
    console.log(Number.parseInt('12.12312')); // 12
    console.log(Number.parseInt(12.12312)); // 12
    console.log(Number.parseInt(null)); //   NaN
    console.log(Number.parseInt(undefined)); //  NaN
    console.log(Number.parseInt('1.23')); // 1
    // 4、Number.isInteger函数：用来判断是否是整数
    console.log(Number.isInteger(1)); // t
    console.log(Number.isInteger('1')); // f 
    console.log(Number.isInteger(1.2222)); // f
    console.log(Number.isInteger(null)); // f
    console.log(Number.isInteger(undefined)); // f
    console.log(Number.isInteger(1.0000000000)); //  t
    // 5、Math.trunc函数：用于去除一个数的小数部分，返回整数部分。 会隐式类型转换
    console.log(Math.trunc(1.63214)); // 1
    console.log(Math.trunc('1.23214')); // 1
    console.log(Math.trunc(null)); // 0
    console.log(Math.trunc(undefined)); // NaN
    console.log(Math.trunc(1.00000)); // 1
    // 6、Math.sign函数：用来判断一个数到底是正数 1、负数 -1、还是零 0。
    console.log(Math.sign(1.12321)); // 1
    console.log(Math.sign(-1.12321)); // -1
    console.log(Math.sign(0)); //0 
    console.log(Math.sign(null)); // 0
    console.log(Math.sign(true)); // 1
    console.log(Math.sign(undefined)); // NaN
</script>

<script>
    console.log(Number.parseInt == parseInt);
</script>

</html>